package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	fmt.Print("请输入一个字符串: ")
	input_1, _ := reader.ReadString('\n')
	num := input_1[:len(input_1)-2]
	result_char := rune(num[0])
	result := ""
	count := 0
	for _, char := range num {
		if char == result_char {
			count++
		} else {
			result += string(result_char)
			result += strconv.Itoa(count)
			result_char = char
			count = 1
		}
	}
	result += string(result_char)
	result += strconv.Itoa(count)
	fmt.Println("压缩后字符串是：", result)
}
